package com.yykj.hospital.server.converter;

import com.yykj.hospital.client.dto.HospitalDTO;
import com.yykj.hospital.server.model.entity.Hospital;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by chendg on 2021/9/9 0009.
 */
@Data
public class HospitalDTOConverter {

	public static HospitalDTO convert(Hospital hospital) {
		HospitalDTO hospitalDTO = new HospitalDTO();
		BeanUtils.copyProperties(hospital, hospitalDTO);
		return hospitalDTO;
	}

	public static List<HospitalDTO> convert(List<Hospital> list) {
		return list.stream().map(HospitalDTOConverter::convert)
				.collect(Collectors.toList());
	}

}
